package com.group.www.service.impl;

import com.group.www.dao.impl.IGoodsinfoDao;
import com.group.www.interfaces.IGoodsInfo_q;
import com.group.www.pojo.GoodsInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@com.alibaba.dubbo.config.annotation.Service
@Service
public class SimpleIGoodsinfo_qService implements IGoodsInfo_q {

    @Autowired
    private IGoodsinfoDao iGoodsinfoDao;

    @Override
    public List<GoodsInfo> queryGoodsInfoBycategoryid(Integer categoryid) {
       return iGoodsinfoDao.queryGoodsInfoBycategoryid(categoryid);
    }

    @Override
    public List<GoodsInfo> queryGoodsInfoBygoodsid(Integer goodsid) {
        return this.iGoodsinfoDao.queryGoodsInfoBygoodsid(goodsid);
    }

    @Override
    public boolean add(Object entity) {
        if(entity instanceof GoodsInfo){
            this.iGoodsinfoDao.save((GoodsInfo)entity);
            return true;
        }
        return false;
    }

    @Override
    public boolean update(Object entity) {
        if(entity instanceof GoodsInfo){
            this.iGoodsinfoDao.updateById((GoodsInfo)entity);
            return true;
        }
        return false;
    }

    @Override
    public List query() {
        return this.iGoodsinfoDao.queryAll();
    }

    @Override
    public boolean delete(Object entity) {
        if(entity instanceof GoodsInfo){
            this.iGoodsinfoDao.delete((GoodsInfo)entity);
        }
        return false;
    }
}
